#!/usr/bin/env python
# encoding: utf-8
"""
locatingsystem.py

Created by Luke on 2009-05-04.
Copyright (c) 2009 Alibaba.com. All rights reserved.
"""

import sys
import os
import urllib
import json

class LocatingSystem:
	def get_ip_json(self,ip):
		url="http://iplocationtools.com/ip_query.php?ip=%s&output=json"%ip
		return json.read(urllib.urlopen(url).read())
		
	def get_mobile_json(self,mobile):
		url="http://api.showji.com/locating/?m=%s&output=json"%mobile
		return json.read(urllib.urlopen(url).read())
				
def main():
	ls = LocatingSystem()
	print ls.get_ip_json("134.34.54.56")
	print ls.get_mobile_json("13819127490")


if __name__ == '__main__':
	main()

